package kr.hyosang.android.penfo.data;

import java.util.ArrayList;

import kr.hyosang.android.penfo.board.FreeBoardActivity;

public class Article
{
	public final static int BOARD_HOTNOW = 1;
    public final static int BOARD_FREEBOARD = 2;
    public final static int BOARD_REVIEW = 3;
    public final static int BOARD_QNA = 4;
	
	public int nBoardType;
    public String date;
    public String subject;
    public String no;
    public String htmlContent;
    public String category;
    public String writer;
    public String profileUrl;
    public String regdate;
    public String hitcount;
    public ArrayList<String> attachments;
    public int nComment;
    public ArrayList<Comment> comment;
    public String nListPage;
    
    public static Class<?> getBoardActivity(Article a) {
    	switch(a.nBoardType) {
    	case BOARD_FREEBOARD:
    		return FreeBoardActivity.class;
    	}
    	
    	return null;
    }
    
    public void clear() {
        nBoardType = -1;
        date = subject = no = htmlContent = category = writer = profileUrl = regdate = hitcount = nListPage = "";
        attachments.clear();
        nComment = 0;
        comment.clear();
    }
    
    public void addAttachment(String a) {
    	if(this.attachments == null) {
    		this.attachments = new ArrayList<String>();
    	}
    	
    	this.attachments.add(a);
    }
    
    public void addComment(Comment c) {
    	if(this.comment == null) {
    		this.comment = new ArrayList<Comment>();
    	}
    	
    	this.comment.add(c);
    }
}
